﻿Public Class bmi
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        lbl_result.Text = getBMI(TB_weight.Text, TB_height.Text)

    End Sub

    Private Function getBMI(ByVal weightStr As String, ByVal heightStr As String) As String
        Dim weight, height As Single
        weight = CSng(weightStr)
        height = CSng(heightStr)
        Dim result As Single
        result = weight / (height ^ 2)
        Return CStr(result)
    End Function
End Class